﻿namespace LogManager.Gui.Factories
{
    using LogManager.Core.Models;
    using LogManager.Gui.ViewModels;
    using LogManager.Utils.Unity;
    using Microsoft.Practices.Unity;

    public class ViewModelFactory : IViewModelFactory
    {
        public readonly IUnityContainer _container;
        public ViewModelFactory(IUnityContainer container)
        {
            _container = container;
        }

        public ILocationViewModel CreateLocationViewModel(ILocation location)
        {
            return _container.Resolve<ILocation, ILocationViewModel>(location);
        }

        public IServerViewModel CreateServerViewModel(IServer server)
        {
            return _container.Resolve<IServer, IServerViewModel>(server);
        }

        public IPlateformViewModel CreatePlateformViewModel(IPlateform plateform)
        {
            return _container.Resolve<IPlateform, IPlateformViewModel>(plateform);
        }

        public IWarehouseViewModel CreateWarehouseViewModel(IWarehouse warehouse)
        {
            return _container.Resolve<IWarehouse, IWarehouseViewModel>(warehouse);
        }

        public IMainViewModel CreateMainViewModel()
        {
            return _container.Resolve<IMainViewModel>();
        }

        public ISettingsViewModel CreateSettingsViewModel(ISettings settings)
        {
            return _container.Resolve<ISettings, ISettingsViewModel>(settings);
        }

        public ICheckLocationsViewModel CreateCheckLocationsViewModel(IConfiguration configuration)
        {
            return _container.Resolve<IConfiguration, ICheckLocationsViewModel>(configuration);
        }

        public IExecuteArchivingViewModel CreateExecuteArchivingViewModel(IConfiguration configuration)
        {
            return _container.Resolve<IConfiguration, IExecuteArchivingViewModel>(configuration);
        }
    }
}
